home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 June / MACPOWER-1997-06.ISO.7z / MACPOWER-1997-06.ISO / AMUG / PROGRAMMING / BSDSoundLib 1.0.1.sit / BSDSoundLib dist / BSDSoundLib ƒ / BSDSoundLib.doc < prev    next >
Text File  |  1997-01-21  |  3KB  |  93 lines

  1. BSDSoundLib v1.0.1
  2. BuggySoftェ Development
  3. By Scott Dunbar.
  4. ゥ 1997.
  5.  
  6. general email    :    BuggySoft@post1.com
  7. tech support    :    sdunbar@post1.com
  8. web                :    http://www.aimnet.com/~buggysft/
  9. ftp                :    ftp://ftp.aimnet.com/pub/users/buggysft/
  10.  
  11. BSDSoundLib is a CodeWarrior 10(still waiting for 11 in the mail :) library that I made for 
  12. my own use in a game of ours called Torture Chamber. You can use this lib free of charge, but
  13. please send me an email or something (it's only fair).
  14.  
  15. With this, you can easily have async sound play-back on multiple channels (RAM permitting) 
  16. and do some cool stereo panning as well as have background music. In my opinion, this is the
  17. easiest set of sound routines to use ever.
  18.  
  19. Call this routines like this:
  20.  
  21. // to play one sound normally
  22. {
  23.         // get your sound to play
  24.     Handle    sndHandle = GetResource('snd ', 128);    
  25.  
  26.         // Initialize the sound channels and stuff
  27.     InitSoundUtils();
  28.         
  29.         // grab a free channel
  30.     short chanNum = FindFreeChannel();
  31.     
  32.         // check to see if a channel was found (-1 is returned if not)
  33.         // then play the sound on that channel
  34.     if (chanNum != -1) PlaySound(chanNum, sndHandle);
  35.     
  36.         // wait until the sound is done (or do anything that you want)
  37.     while (sndChanActive[chanNum]);
  38.     
  39.         // Silence the channel if needed
  40.     SilenceChannel(chanNum);
  41.     
  42.         // Dispose of everything (except your aquired sound handles when you're done
  43.     DisposeSoundUtils();
  44. }    
  45.  
  46. // to change the volume of a channel
  47. {
  48. /*
  49.     setup a channel and start it playing first
  50. */
  51.     SetChanVol(chanNum, kMaxLeft);    // sets the left volume full and the right to 0
  52.     SetChanVol(chanNum, kMaxRight);    // sets the right volume full and the left to 0
  53.     SetChanVol(chanNum, kBalanced);    // balances the volume on a given channel
  54.     
  55.     BalanceSndChannels();            // balances volume on all channels
  56.     
  57. /*
  58.     you can use any number from -128 to 128 for the volume.
  59. */
  60. }
  61.  
  62. // to play a sound and keep it looping (for cool background music or something)
  63. {
  64.         // get your sound to play
  65.     Handle    sndHandle = GetResource('snd ', 128);    
  66.  
  67.         // Initialize the looping sound channel
  68.     InitLoopingSounds();
  69.     
  70.         // Start the sound on its jolly little looping way
  71.     PlayLoopingSound(sndHandle);
  72.     
  73.         // Silence the channel if needed
  74.     SilenceLoopingChannel();
  75.     
  76.         // Dispose of the sound channel (except your aquired sound handles) when you're done
  77.     DisposeLoopingSounds();
  78. }    
  79.  
  80.  
  81. Check out the header, "BSDSoundLib.h," for more info on them.
  82. I've got some more stuff planned, but I'm too tired to add them now. Check back with me later
  83. if you want the latest version.
  84.  
  85. For working examples of the library in use, check in the 'examples' folder 
  86. contained in this archive.
  87.  
  88. Drop by our web page for updates at:
  89.     "http://www.aimnet.com/~buggysft/"
  90.  
  91.  
  92. Thanks!
  93.     - Scott Dunbar